package leecode.q242;

public class Solution {

    public boolean isAnagram(String s, String t) {
        int[] array = new int[26];
        if (s.length() != t.length()) {
            return false;
        }
        for (int i = 0; i < s.length(); i++) {
            int first = s.charAt(i) - 'a';
            int second = t.charAt(i) - 'a';
            array[first] = array[first] + 1;
            array[second] = array[second] - 1;
        }
        for (int i : array) {
            if (i != 0)
                return false;
        }
        return true;
    }
}
